package com.akeil.flash.labelprovider;

import java.text.DecimalFormat;

import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;

import com.akeil.flash.pojo.Data;

public class DataLabelProvider extends LabelProvider implements
		ITableLabelProvider {
	DecimalFormat df = new DecimalFormat("0.0000");
	DecimalFormat df1 = new DecimalFormat("0.00");
	/*SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss" );*/
	
	@Override
	public String getColumnText(Object element, int columnIndex) {
		// TODO Auto-generated method stub
		Data data = (Data) element;
		if (columnIndex == 0) {
			return String.valueOf(data.getInd());
		}else if (columnIndex == 1) {
			return data.getSamplename();
		}else if (columnIndex == 2) {
			return data.getSampleno();
		}else if (columnIndex == 3) {
			return df1.format(data.getPretemperature());
		} else if (columnIndex == 4) {
			return df1.format(data.getFlashtemperature());
		}else if (columnIndex == 5) {
			return data.getTesttime();
		}

		return null;
	}

	public Image getColumnImage(Object obj, int index) {
		return null;
	}

	public Image getImage(Object obj) {
		return PlatformUI.getWorkbench().getSharedImages()
				.getImage(ISharedImages.IMG_OBJ_ELEMENT);
	}
}